//
// Created by wxd on 2025/7/14.
//

#include "VAO.h"

#include "monitor/GLDebug.hpp"

VAO::VAO() {
    m_VAO = 0;

    GL_CALL(glGenVertexArrays(1, &m_VAO))
    GL_CALL(glBindVertexArray(m_VAO))
}

VAO::~VAO() {
    destroy();
}

GLuint VAO::getVAO() const {
    return m_VAO;
}

void VAO::bind() const {
    GL_CALL(glBindVertexArray(m_VAO))
}

void VAO::unbind() {
    GL_CALL(glBindVertexArray(0))
}

void VAO::destroy() {
    if (m_VAO != 0) {
        GL_CALL(glDeleteVertexArrays(1, &m_VAO))
        m_VAO = 0;
    }
}




